-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #16822 #16884
fix #16822 #16884
Conversation
@xflywind, awesome this also fixes #14574; please add these tests: block: # bug #14574
proc fn(): auto =
let a = @[("foo", (12, 13))]
for (k,v) in a:
return (k,v)
doAssert fn() == ("foo", (12, 13))
block: # bug #14574
iterator fn[T](a:T): lent T = yield a
let a = (10, (11,))
proc bar(): auto =
for (x,y) in fn(a):
return (x,y)
doAssert bar() == (10, (11,)) and change:
to # bug #14574
testRoundtrip({"z": (f1: 'f'), }.toTable): """{"z":{"f1":102}}""" in and add: "fix #14574" to your PR description so it auto-closes it thanks! |
@@ -1077,10 +1077,10 @@ proc genAsgnAux(p: PProc, x, y: PNode, noCopyNeeded: bool) = | |||
# supports proc getF(): var T | |||
if x.kind in {nkHiddenDeref, nkDerefExpr} and x[0].kind in nkCallKinds: | |||
lineF(p, "nimCopy($1, $2, $3);$n", | |||
[a.res, b.res, genTypeInfo(p, y.typ)]) | |||
[a.res, b.res, genTypeInfo(p, x.typ)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does
lineF(p, "$1 = nimCopy(null, $2, $3);$n",
[a.rdLoc, b.res, genTypeInfo(p, y.typ)])
a few lines above also need to change to y.typ => x.typ?
(I don't know which one is correct)
@timotheecour's remarks can be done later, merging this as it is because it's small and simple. |
* see whether it breaks * fix nim-lang#16884 * correct * fix nim-lang#14574
fix #16822
fix #14574
The kind of y may be
nkHiddenAddr
(so could be fixed byskipAddr
too), so usingx.type
may be more correct.